package com.main.modulemysql.web;


import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.plugins.Page;
import com.main.modulemysql.entity.Facilities;
import com.main.modulemysql.service.IFacilitiesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author IceZhang
 * @since 2018-08-07
 */
@Api(tags = "facilities page data")
@RestController
@ResponseBody
@RequestMapping("/facilities")
public class FacilitiesController {

    @Autowired
    IFacilitiesService iFacilitiesService;

    @ApiOperation(value = "获取各种设施的分页",notes = "获取各种设施的分页")
    @RequestMapping(value = "/page",method = RequestMethod.POST)
    @ResponseBody
    public String facilityPage(@RequestParam(value = "current",defaultValue = "1")@ApiParam(name = "当前页")Integer current, @RequestParam(value = "size",defaultValue = "10")@ApiParam(name = "分页大小")Integer size){
        Page<Facilities> facilitiesPage = iFacilitiesService.selectFacilitiesPage(current,size);
        return JSON.toJSONString(facilitiesPage);
    }

}

